text=input("请输入一段文字：")
with open(r"D:\hello.txt","w",encoding="utf-8") as f:
    f.write(text)
print("文字已保存到 D:\\hello.txt")